/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package procrastinator;

import java.util.Date;
import procrastinator.table.ActivityTable.Period;

/**
 *
 * @author alex
 */
public class Activity {

        private Date from,  to;
        private String activity,  category;

        public Activity(Date from, Date to, String activity, String category) {
            this.from = from;
            this.to = to;
            this.activity = activity;
            this.category = category;
        }

        public String getActivity() {
            return activity;
        }

        public void setActivity(String activity) {
            this.activity = activity;
        }

        public String getCategory() {
            return category;
        }

        public void setCategory(String category) {
            this.category = category;
        }

        public Date getFrom() {
            return from;
        }

        public void setFrom(Date from) {
            this.from = from;
        }

        public Date getTo() {
            return to;
        }

        public void setTo(Date to) {
            this.to = to;
        }

        public Object getValueAt(int column) {
            switch (column) {
                case 0:
                    return new Period(from, to);
                case 1:
                    return activity;
                case 2:
                    return category;
                default:
                    return null;
            }
        }

        public void setValueAt(int column, Object object) {
            switch (column) {
                case 0:
                    Period p = (Period) object;
                    from = p.from;
                    to = p.to;
                    break;
                case 1:
                    activity = (String) object;
                    break;
                case 2:
                    category = (String) object;
                    break;
            }
        }
}
